import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import { Provider } from 'react-redux' 
import reducers from './reducers'
import AuthRoute from './component/authroute/authRoute'
import Login from './container/login/login'
import Register from './container/register/register'
import Bossinfo from './container/bossinfo/bossinfo'
import Geniusinfo from './container/geniusinfo/geniusinfo'
import Dashboard from './container/dashboard/dashboard'
import Chat from './component/chat/chat' 
import './utils/request'

// const store = createStore(reducers, compose(
//   applyMiddleware(thunk),
//   window.devToolsExtension ? window.devToolsExtension() : () => {}
// ))
const store = createStore(reducers, applyMiddleware(thunk))

class App extends Component{
  render() {
    return (
      <Provider store={ store }>
        <Router>
          <div>
            <AuthRoute />
            <Switch>
              <Route path="/bossinfo" component={ Bossinfo } />
              <Route path="/geniusinfo" component={ Geniusinfo } />
              <Route path="/login" component={ Login } />
              <Route path="/register" component={ Register } />
              <Route path="/chat/:user" component={ Chat } />
              <Route component={ Dashboard } />
            </Switch>
          </div>
        </Router>
      </Provider>
    )
  }
}

export default App